package com.gzh.system.controller;

import com.gzh.core.model.vo.Result;
import com.gzh.core.service.CheckToken;
import com.gzh.core.util.RequestContextUtil;
import com.gzh.system.model.vo.SchoolQueryParam;
import com.gzh.system.service.CommonService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author guanzh
 * @Date 2022/3/2 14:40
 * @Description
 */
@Slf4j
@RequestMapping("/v1/api/comm")
@RestController
public class CommonController {
    @Autowired
    private CommonService commonService;

    @GetMapping("/queryMenu")
    @CheckToken
    public ResponseEntity<?> queryMenu() {
        Integer userId = RequestContextUtil.getCurrentUserId();
        return Result.ok(commonService.queryMenu(userId));
    }
    @GetMapping("/getSchoolList")
    public ResponseEntity<?> getSchoolList(SchoolQueryParam param) {
        return Result.ok(commonService.getSchoolList(param.paramToIn()));
    }

    @GetMapping("/getALLClass")
    public ResponseEntity<?> getALLClass() {
        return Result.ok(commonService.getALLClass());
    }
}
